/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ronsicecream.pos.entities;

import com.buanalintas.bynga.entities.MasterUnit;
import com.buanalintas.bynga.entities.MasterUser;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author user
 */
@Entity
@Table(name = "pos_master_item_stock")
@XmlRootElement
//@NamedQueries({
//    @NamedQuery(name = "PosMasterItemStock.findAll", query = "SELECT p FROM PosMasterItemStock p"),
//    @NamedQuery(name = "PosMasterItemStock.findBySync", query = "SELECT p FROM PosMasterItemStock p WHERE p.sync = :sync"),
//    @NamedQuery(name = "PosMasterItemStock.findByItemStockId", query = "SELECT p FROM PosMasterItemStock p WHERE p.itemStockId = :itemStockId"),
//    @NamedQuery(name = "PosMasterItemStock.findByItemStockValue", query = "SELECT p FROM PosMasterItemStock p WHERE p.itemStockValue = :itemStockValue"),
//    @NamedQuery(name = "PosMasterItemStock.findByItemStockTimestamp", query = "SELECT p FROM PosMasterItemStock p WHERE p.itemStockTimestamp = :itemStockTimestamp")})
public class PosMasterItemStock implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "item_stock_id")
    private Integer itemStockId;
    @Column(name = "item_stock_value")
    private BigDecimal itemStockValue;
    @Column(name = "item_stock_timestamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date itemStockTimestamp;
    @JoinColumn(name = "item_stock_status_id", referencedColumnName = "status_id")
    @ManyToOne(optional = false)
    private PosMasterStatus itemStockStatusId;
//    @JoinColumn(name = "item_stock_satuan_id", referencedColumnName = "satuan_id")
//    @ManyToOne(optional = false)
//    private PosMasterSatuan itemStockSatuanId;
    @JoinColumn(name = "item_stock_regional_id", referencedColumnName = "regional_id")
    @ManyToOne(optional = false)
    private PosMasterRegional itemStockRegionalId;
    @JoinColumn(name = "item_stock_item_id", referencedColumnName = "item_id")
    @ManyToOne(optional = false)
    private PosMasterItem itemStockItemId;
    @JoinColumn(name = "item_stock_unit_id", referencedColumnName = "unit_id")
    @ManyToOne
    private MasterUnit itemStockUnitId;
    @JoinColumn(name = "item_stock_pos_unit_id", referencedColumnName = "unit_id")
    @ManyToOne
    private PosMasterUnit itemStockPosUnitId;

    public PosMasterItemStock() {
    }

    public PosMasterItemStock(Integer itemStockId) {
        this.itemStockId = itemStockId;
    }

    public PosMasterItemStock(Integer itemStockId, String sync) {
        this.itemStockId = itemStockId;
        this.sync = sync;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getItemStockId() {
        return itemStockId;
    }

    public void setItemStockId(Integer itemStockId) {
        this.itemStockId = itemStockId;
    }

    public BigDecimal getItemStockValue() {
        return itemStockValue;
    }

    public void setItemStockValue(BigDecimal itemStockValue) {
        this.itemStockValue = itemStockValue;
    }

    public MasterUnit getItemStockUnitId() {
        return itemStockUnitId;
    }

    public void setItemStockUnitId(MasterUnit itemStockUnitId) {
        this.itemStockUnitId = itemStockUnitId;
    }

    public PosMasterUnit getItemStockPosUnitId() {
        return itemStockPosUnitId;
    }

    public void setItemStockPosUnitId(PosMasterUnit itemStockPosUnitId) {
        this.itemStockPosUnitId = itemStockPosUnitId;
    }

//    public MasterUser getItemStockUserId() {
//        return itemStockUserId;
//    }
//
//    public void setItemStockUserId(MasterUser itemStockUserId) {
//        this.itemStockUserId = itemStockUserId;
//    }

    public Date getItemStockTimestamp() {
        return itemStockTimestamp;
    }

    public void setItemStockTimestamp(Date itemStockTimestamp) {
        this.itemStockTimestamp = itemStockTimestamp;
    }

    public PosMasterStatus getItemStockStatusId() {
        return itemStockStatusId;
    }

    public void setItemStockStatusId(PosMasterStatus itemStockStatusId) {
        this.itemStockStatusId = itemStockStatusId;
    }

//    public PosMasterSatuan getItemStockSatuanId() {
//        return itemStockSatuanId;
//    }
//
//    public void setItemStockSatuanId(PosMasterSatuan itemStockSatuanId) {
//        this.itemStockSatuanId = itemStockSatuanId;
//    }

    public PosMasterRegional getItemStockRegionalId() {
        return itemStockRegionalId;
    }

    public void setItemStockRegionalId(PosMasterRegional itemStockRegionalId) {
        this.itemStockRegionalId = itemStockRegionalId;
    }

    public PosMasterItem getItemStockItemId() {
        return itemStockItemId;
    }

    public void setItemStockItemId(PosMasterItem itemStockItemId) {
        this.itemStockItemId = itemStockItemId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (itemStockId != null ? itemStockId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosMasterItemStock)) {
            return false;
        }
        PosMasterItemStock other = (PosMasterItemStock) object;
        if ((this.itemStockId == null && other.itemStockId != null) || (this.itemStockId != null && !this.itemStockId.equals(other.itemStockId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.buanalintas.ronsicecream.pos.entities.PosMasterItemStock[ itemStockId=" + itemStockId + " ]";
    }
    
}
